# Author: mosra <mosra@centrum.cz>
pkgname=magnum-plugins
pkgver=dev
pkgrel=1
pkgdesc="Plugins for the Magnum C++11/C++14 graphics engine"
arch=('i686' 'x86_64')
url="https://magnum.graphics"
license=('MIT')
depends=('magnum' 'devil' 'faad2' 'freetype2' 'harfbuzz' 'libjpeg' 'libpng' 'assimp' 'meshoptimizer' 'spirv-tools' 'glslang')
makedepends=('cmake' 'ninja' 'basis-universal-src')
options=(!strip)
provides=('magnum-plugins-git')

_rootdir=$startdir/../../

build() {
    mkdir -p "$_rootdir/build"
    cd "$_rootdir/build"

    cmake .. \
        -DCMAKE_BUILD_TYPE=Debug \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DBASIS_UNIVERSAL_DIR=/opt/basis-universal \
        -DBUILD_TESTS=ON \
        -DBUILD_GL_TESTS=ON \
        -DWITH_ASSIMPIMPORTER=ON \
        -DWITH_BASISIMAGECONVERTER=ON \
        -DWITH_BASISIMPORTER=ON \
        -DWITH_DDSIMPORTER=ON \
        -DWITH_DEVILIMAGEIMPORTER=ON \
        -DWITH_DRFLACAUDIOIMPORTER=ON \
        -DWITH_DRMP3AUDIOIMPORTER=ON \
        -DWITH_DRWAVAUDIOIMPORTER=ON \
        -DWITH_FAAD2AUDIOIMPORTER=ON \
        -DWITH_FREETYPEFONT=ON \
        -DWITH_GLSLANGSHADERCONVERTER=ON \
        -DWITH_HARFBUZZFONT=ON \
        -DWITH_ICOIMPORTER=ON \
        -DWITH_JPEGIMAGECONVERTER=ON \
        -DWITH_JPEGIMPORTER=ON \
        -DWITH_MESHOPTIMIZERSCENECONVERTER=ON \
        -DWITH_MINIEXRIMAGECONVERTER=ON \
        -DWITH_OPENGEXIMPORTER=ON \
        -DWITH_PNGIMAGECONVERTER=ON \
        -DWITH_PNGIMPORTER=ON \
        -DWITH_PRIMITIVEIMPORTER=ON \
        -DWITH_SPIRVTOOLSSHADERCONVERTER=ON \
        -DWITH_STANFORDIMPORTER=ON \
        -DWITH_STANFORDSCENECONVERTER=ON \
        -DWITH_STBIMAGECONVERTER=ON \
        -DWITH_STBIMAGEIMPORTER=ON \
        -DWITH_STBTRUETYPEFONT=ON \
        -DWITH_STBVORBISAUDIOIMPORTER=ON \
        -DWITH_STLIMPORTER=ON \
        -DWITH_TINYGLTFIMPORTER=ON \
        -G Ninja
    ninja
}

check() {
    cd "$_rootdir/build"
    CORRADE_TEST_COLOR=ON ctest --output-on-failure -j5
}

package() {
    cd "$_rootdir/build"
    DESTDIR="$pkgdir/" ninja install
}
